home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / J-M / Mass Compacter.cpt / Mass Compacter / card_2875.txt < prev    next >
Text File  |  1989-02-26  |  9KB  |  351 lines

  1. -- card: 2875 from stack: in
  2. -- bmap block id: 4008
  3. -- flags: 4000
  4. -- background id: 2710
  5. -- name: 
  6. ----- HyperTalk script -----
  7. --**** NASS COMPACTER   by Brian D. McLean, D.D.S. ****
  8. --
  9. -- uses the XFCN Files() by
  10.  
  11. on packem
  12.  
  13.   --IF YOU PASTE THIS SCRIPT ELSEWHERE THEN DELETE ALL
  14.   --      THESE LINES IN UPPER CASE.
  15.   GLOBAL EXAMINED,COMPACTED,SAVED,ABORT
  16.   PUT TRUE INTO ABORT
  17.   -- IF YOU PASTE THIS STACK ELSEWHERE THEN DELETE ALL THE UPPER CASE
  18.   -- LINES.
  19.  
  20.   global compacterPath
  21.   ask "Compact stacks in what directory (complete path)" with compacterPath
  22.   if it is not empty then
  23.     put it into compacterPath
  24.     Put Files(it,"STAK") into stacknames
  25.   else
  26.     exit packem
  27.   end if
  28.   push  card
  29.  
  30.   --IF YOU PASTE THIS SCRIPT ELSEWHERE THEN DELETE ALL
  31.   --      THESE LINES IN UPPER CASE.
  32.   PUT FALSE INTO ABORT
  33.   -- IF YOU PASTE THIS STACK ELSEWHERE THEN DELETE ALL THE UPPER CASE
  34.   -- LINES.
  35.  
  36.   put zero into examined
  37.   put zero into compacted
  38.   put zero into saved
  39.   repeat with x = 1 to  number of lines of stacknames
  40.     put line x of stacknames into thisstack
  41.     put "Checking " & quote & thisstack & quote
  42.     get the freesize of stack thisstack
  43.     add it to saved
  44.     add one to examined
  45.     put " -- Freesize is"&&it after msg
  46.     if it is zero then
  47.       wait 30
  48.     else
  49.       set lockmessages to true
  50.       set lockscreen to true
  51.       go to stack thisstack
  52.       put "Compacting" into first word of msg
  53.       domenu "compact stack"
  54.       add one to compacted
  55.     end if
  56.   end repeat
  57.   pop card
  58.  
  59.   --IF YOU PASTE THIS SCRIPT ELSEWHRE THEN DELETE THE TWO DASHES ‚Äú--‚Äù
  60.   --IN THE FOLLOWING 3 LINES...
  61.   Put "All done!" --  && "Examined" && examined && "stacks; compacted" -- && compacted &&"to regain" && saved && "bytes."
  62.   -- wait 3 seconds
  63.  
  64.   hide msg
  65. end packem
  66.  
  67.  
  68.  
  69. -- part 4 (field)
  70. -- low flags: 01
  71. -- high flags: 2001
  72. -- rect: left=41 top=64 right=289 bottom=389
  73. -- title width / last selected line: 0
  74. -- icon id / first selected line: 0 / 0
  75. -- text alignment: 0
  76. -- font id: 3
  77. -- text size: 9
  78. -- style flags: 0
  79. -- line height: 12
  80. -- part name: 
  81.  
  82.  
  83. -- part 10 (button)
  84. -- low flags: 00
  85. -- high flags: A003
  86. -- rect: left=410 top=137 right=155 bottom=480
  87. -- title width / last selected line: 0
  88. -- icon id / first selected line: 0 / 0
  89. -- text alignment: 1
  90. -- font id: 0
  91. -- text size: 12
  92. -- style flags: 0
  93. -- line height: 16
  94. -- part name: Packem
  95. ----- HyperTalk script -----
  96. on mouseUp
  97.   global examined,compacted,saved,compacterpath,abort
  98.   if the short name of the target is "Return" then
  99.     set the name of the target to "Packem"
  100.     hide card field "results"
  101.   else if the short name of the target is "Packem" then
  102.     packem
  103.     if abort is true then exit mouseup
  104.     put empty into card field "results"
  105.     put "Result of Stack Compaction in" into line 4 of card field "results"
  106.     put compacterpath & return & the abbr date && the time into line 5 of card field "results"
  107.     put "Number of stacks examined:" && examined into line 9 of card field "results"
  108.     put "Number of stacks compacted:" && compacted into line 11 of card field "results"
  109.     put "Number of bytes reclaimed:" &&saved into line 13 of card field "results"
  110.     set the name of the target to "Return"
  111.     show card field "results"
  112.   end if
  113. end mouseUp
  114.  
  115.  
  116.  
  117. -- part 11 (button)
  118. -- low flags: 00
  119. -- high flags: A003
  120. -- rect: left=410 top=178 right=196 bottom=480
  121. -- title width / last selected line: 0
  122. -- icon id / first selected line: 0 / 0
  123. -- text alignment: 1
  124. -- font id: 0
  125. -- text size: 12
  126. -- style flags: 0
  127. -- line height: 16
  128. -- part name: Script
  129. ----- HyperTalk script -----
  130. on mouseUp
  131.   edit script of this card
  132. end mouseUp
  133.  
  134.  
  135.  
  136. -- part 17 (button)
  137. -- low flags: 00
  138. -- high flags: 0000
  139. -- rect: left=451 top=286 right=313 bottom=486
  140. -- title width / last selected line: 0
  141. -- icon id / first selected line: 11045 / 11045
  142. -- text alignment: 1
  143. -- font id: 0
  144. -- text size: 12
  145. -- style flags: 0
  146. -- line height: 16
  147. -- part name: Home
  148. ----- HyperTalk script -----
  149. on mouseUp
  150.   visual effect dissolve to black
  151.   visual effect dissolve to white
  152.   visual effect dissolve
  153.   go home
  154. end mouseUp
  155.  
  156.  
  157.  
  158. -- part 2 (field)
  159. -- low flags: 81
  160. -- high flags: 0004
  161. -- rect: left=437 top=48 right=316 bottom=488
  162. -- title width / last selected line: 0
  163. -- icon id / first selected line: 0 / 0
  164. -- text alignment: 1
  165. -- font id: 0
  166. -- text size: 18
  167. -- style flags: 6144
  168. -- line height: 24
  169. -- part name: info title
  170.  
  171.  
  172. -- part 3 (button)
  173. -- low flags: 00
  174. -- high flags: 0000
  175. -- rect: left=446 top=35 right=61 bottom=477
  176. -- title width / last selected line: 0
  177. -- icon id / first selected line: 19678 / 19678
  178. -- text alignment: 1
  179. -- font id: 0
  180. -- text size: 12
  181. -- style flags: 0
  182. -- line height: 16
  183. -- part name: 
  184. ----- HyperTalk script -----
  185. on mouseUp
  186.   set the scroll of card field "info" to zero
  187.   set visible of Card field "info" to not visible of card field "info"
  188.   set visible of Card field "info title" to not visible of card field "info title"
  189. end mouseUp
  190.  
  191.  
  192.  
  193. -- part 6 (field)
  194. -- low flags: 01
  195. -- high flags: 0000
  196. -- rect: left=204 top=280 right=315 bottom=379
  197. -- title width / last selected line: 0
  198. -- icon id / first selected line: 0 / 0
  199. -- text alignment: 0
  200. -- font id: 3
  201. -- text size: 9
  202. -- style flags: 256
  203. -- line height: 12
  204. -- part name: 
  205.  
  206.  
  207. -- part 18 (field)
  208. -- low flags: 81
  209. -- high flags: 2004
  210. -- rect: left=102 top=85 right=214 bottom=338
  211. -- title width / last selected line: 0
  212. -- icon id / first selected line: 0 / 0
  213. -- text alignment: 0
  214. -- font id: 3
  215. -- text size: 9
  216. -- style flags: 0
  217. -- line height: 12
  218. -- part name: note
  219. ----- HyperTalk script -----
  220. on mouseup
  221.   hide card field note
  222. end mouseup
  223.  
  224.  
  225.  
  226. -- part 1 (field)
  227. -- low flags: 81
  228. -- high flags: 2007
  229. -- rect: left=17 top=28 right=320 bottom=437
  230. -- title width / last selected line: 0
  231. -- icon id / first selected line: 0 / 0
  232. -- text alignment: 0
  233. -- font id: 3
  234. -- text size: 10
  235. -- style flags: 0
  236. -- line height: 13
  237. -- part name: info
  238.  
  239.  
  240. -- part 7 (field)
  241. -- low flags: 80
  242. -- high flags: 0004
  243. -- rect: left=36 top=59 right=321 bottom=393
  244. -- title width / last selected line: 0
  245. -- icon id / first selected line: 0 / 0
  246. -- text alignment: 1
  247. -- font id: 0
  248. -- text size: 12
  249. -- style flags: 256
  250. -- line height: 16
  251. -- part name: Results
  252.  
  253.  
  254. -- part 19 (button)
  255. -- low flags: 00
  256. -- high flags: 2000
  257. -- rect: left=127 top=235 right=250 bottom=141
  258. -- title width / last selected line: 0
  259. -- icon id / first selected line: 0 / 0
  260. -- text alignment: 1
  261. -- font id: 0
  262. -- text size: 12
  263. -- style flags: 0
  264. -- line height: 16
  265. -- part name: 
  266. ----- HyperTalk script -----
  267. on mouseUp
  268.   show card field "note"
  269. end mouseUp
  270.  
  271.  
  272.  
  273. -- part contents for card part 1
  274. ----- text -----
  275. Files() is a XFCN to get a list of files in a HFS directory.
  276.  
  277. You can specify the path name to the files and the file type you want to retreive.
  278.  
  279. This is freeware!
  280.  
  281.       Guy de Picciotto.
  282.  
  283. CIS: 73300,3637
  284. GENIE: G.PICCIOTO
  285.  
  286.  
  287. Files() can take 2 parameters:
  288.  
  289. The first one is the path name to look for files. If it does not exist or is empty, the default directory is used (I hope so)
  290.  
  291. The second parameter is the file type. You can look for multiple types. If no second parameter is supplied, files will return all files.
  292.  
  293. In case of an error, the routine will beep and return an empty string.
  294.  
  295. Ex. get Files("mydisk:hypercard","STAK,TXT")
  296.       get Files("mydisk:hypercard")
  297.       get Files("","STAK")
  298.       get Files()
  299.    
  300.  
  301.                                      (CLick ‚ÄúAbout‚Äù baloon to return)
  302.  
  303. -- part contents for card part 4
  304. ----- text -----
  305. The button to the right evokes the script (‚ÄúPackem‚Äù) of this card. 
  306.  
  307. A dialog box requests a full pathname to a desktop or folder.
  308.  
  309. ‚ÄúPackem‚Äù then proceeds to examine the freesize (wasted space) in all the stacks it finds there. If any stacks need compacting, then that is accomplished automatically. In the meantime, you are free to get a cup of coffee. 
  310.  
  311. Progress is displayed via the message box, and a summary of the results is posted upon completion.
  312.  
  313. Suggestion: Paste the card script into your home stack, and use this utility wherever and whenever it is convenient by typing ‚ÄúPackem‚Äù into the message box.(*)
  314.  
  315. Click the ‚ÄúAbout Files() XFCN‚Äù balloon for information about the XFCN which makes all this possible.  
  316.  
  317.  
  318. -- part contents for card part 2
  319. ----- text -----
  320. F   i   l  e    s             ()          
  321.      X         F   C  N
  322.  
  323. -- part contents for card part 6
  324. ----- text -----
  325. Brian D. Mclean
  326. CIS 75026,3724
  327. GEnie B.McLean
  328.  
  329. -- part contents for card part 18
  330. ----- text -----
  331.                     *SPECIAL NOTE*
  332. This has the advantage of overcoming one dumb feature of this demonstration stack:
  333. After ‚ÄúPackem‚Äù has compacted this stack, the button name changes to ‚ÄòReturn‚Äô and then back to ‚ÄòPackem‚Äô, which means the stack is no longer fully compacted.  But then again, its ready for another demonstration!
  334.  
  335.                         (click here)
  336.  
  337. -- part contents for card part 7
  338. ----- text -----
  339.  
  340.  
  341.  
  342. Result of Stack Compaction in
  343. Mailing List:HyperCard Stacks:Empty Folder
  344. Tue, Feb 23, 1988 12:48 AM
  345.  
  346.  
  347. Number of stacks examined: 5
  348.  
  349. Number of stacks compacted: 0
  350.  
  351. Number of bytes reclaimed: 0